package cn.xxstudy.visitshop.network

import android.util.Log
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

/**
 * @author ：DELL on 2021/3/23 .
 * @packages ：cn.xxstudy.visitshop.network .
 * TODO:一句话描述
 */
object  ApiService {
    private val logger =HttpLoggingInterceptor()
    private var client: OkHttpClient
    private var api:Api
    init {
        logger.level=HttpLoggingInterceptor.Level.BODY
        client=OkHttpClient.Builder()
            .addInterceptor(logger)
            .build()

        api= Retrofit.Builder()
            .baseUrl("http://192.168.1.14:8000/visit/")
            .client(client)
            .addConverterFactory(GsonConverterFactory.create())
            .build().create(Api::class.java)
    }

    fun api():Api{
        return api
    }

}